package common.db;

import common.db.repository.SqlQueryParam;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.lang.reflect.Field;
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: ppopovic
 * Date: 22.04.2009.
 * Time: 19.22.41
 * To change this template use File | Settings | File Templates.
 */
public class DBUtilis
{


	public static Integer getInteger(ResultSet rs, String columnName)
	{
		try
		{
			if (!rs.isClosed())
			{
//				Integer i = null;
//				Object pk = null;
//				pk = rs.getObject(columnName);
//				if (pk instanceof Long) i = new Integer(pk.toString());
//				else if (pk instanceof Integer) i = (Integer)pk;

				int i = rs.getInt(columnName);
				return rs.wasNull()?null:i;
			}


		}
		catch (SQLException e)
		{
			e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
		}
		return null;

	}

	

}
